<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="__STATIC__/index/css/main.css">
    <script src="__STATIC__/index/js/jquery-3.2.1.js"></script>
    <title>我的结算</title>
    <style>
        .pub-header .head-block .yrz .user-block .username i{
            top: 31px;
        }
         .my-count{
      	color: #4c6cc9 !important;
		border-color: #4c6cc9 !important;
		background-color: #e3efff;
      }
    </style>
</head>

<body>
    {include file='common/heade'}
		<div class="ext-center">
	     <div class="single_center w_1200">
		       {include file='common/left_tg'}
	             <div class="ext-right">
                  <div class="right-index bg-white">
                      <div class="e-header-b header-menu-item">
                          <span class="title">我的结算</span>
                          <p class="right-eText"><a href="#" class="">安全中心</a>
                          <span class="color-e">保障账号资产安全</span></p>
                      </div>
                      <div class="cheng-money">
                          <div class="one-money inlineB">
                              <p class="title">我的成交金额</p>
                              <p class="amount"><span class="amount-big">0</span> <span class="amount-small">.00</span> <span class="amount-smaller">结算</span></p>
                          </div>
                          <div class="mid-icon inlineB">
                          	{if empty($re)}
                              <div class="temp-box"><a href="{:url('index/market/bindCard')}">
                                  <span class="img-box">
                                      <img src=""></span>
                                  </span>
                                  <span  class="bind-link">[绑定账号]</span></a>
                              </div>
                              {else}
                               <div class="temp-box"><a href="{:url('index/market/updataBindCard')}">
                                  <span class="img-box">
                                      <img src=""></span>
                                  </span>
                                  <span  class="bind-link">[修改账号]</span></a>
                               </div>
                              {/if}
                              <div class="temp-box">
                                  <span class="img-box">
                                      <img src="" class="margin-liitle">
                                  </span>
                                  <a href="#" class="bind-link">[提现记录]</a>
                              </div>
                          </div>
                          <div class="last-btn inlineB">
                              <button type="button" class="put-forward ivu-btn ivu-btn-primary" onclick="cash()">
                                  <span>我要提现</span>
                              </button>
                              <p>
                                  <span>我想看看</span>
                                  <a href="#" class="" target="_blank">提现规则</a>
                              </p>
                          </div>
                      </div>
                      <div class="table-all">
                          <div class="table-search">
                              <a href="#" class="rule-settle" target="_blank">结算规则</a>
                              <div class="search-good right-margin-s ivu-input-wrapper ivu-input-type">
                                  <i class="ivu-icon ivu-icon-ios-search ivu-input-icon ivu-input-icon-normal" onclick="likeGoods()"></i>
                                  <input autocomplete="off" id="like_goods" spellcheck="false" type="text" placeholder="输入您要搜索的记录" class="ivu-input">
                              </div>
                          </div>
                          {volist name="data.goodses" id="vo"}
                          <div class="tables">
                              <p class="table-title">
                                  <label class="check-style ivu-checkbox-wrapper" goods_id="{$vo.id}" onclick="save_balance_id(this,{$vo.id})">
                                      <span class="ivu-checkbox">
                                          <span class="ivu-checkbox-inner"></span>
                                          <input type="checkbox" class="ivu-checkbox-input">
                                      </span>
                                  </label>
                                  <span>商品ID： {$vo.sp_id}</span>
                                  <span class="time">{$vo.add_time}</span>
                              </p>
                              <div class="element">
                                  <div class="inlineB img-title border-e-right">
                                      <span class="img-self" style="background: url(&quot;{$vo.large_img}&quot;) center center / cover no-repeat;"></span>
                                      <div class="inlineB title-article">
                                          <p class="color333 line-h">{$vo.title}</p>
                                          <p class="colorccc line-h-s font-size12"></p>
                                          <p class="icon-sort">
                                              <span class="sort-color">{$vo.goods_cate.name}</span>
                                              <img src="https://img.dacaiji.com/static/image/icon-goods.png" class="img-icon-small">
                                          </p>
                                      </div>
                                  </div>
                                  <div class="trans-num inlineB width100 border-e-right comm-css">
                                      <p>准备推广数量</p>
                                      <p>x{$vo.shuliang}</p>
                                  </div>
                                  <div class="trans-money inlineB width100 border-e-right comm-css">
                                      <p>成交金额</p>
                                      <p>￥{$vo.last_price}</p>
                                  </div>
                                  <div class="trans-money inlineB width100 border-e-right comm-css">
                                      <p>佣金</p>
                                      <p>￥{$vo.money*$vo.commision/100}</p>
                                  </div>

                                  <div class="trans-result inlineB width100 border-e-right comm-css">
                                      <a href="{:url('market/balance_xq',array('goods_id'=>$vo.id))}">查看</a>
                                  </div>
                              </div>
                          </div>
                          {/volist}
                          <label class="check-all ivu-checkbox-wrapper">
                              <span class="ivu-checkbox">
                                  <span class="ivu-checkbox-inner"></span>
                                  <input type="checkbox" class="ivu-checkbox-input">
                              </span> 全选
                          </label>

                          <button onclick="balance()">结算</button>
                          {$data.page}
                      </div>
                  </div>
              </div>
          </div>
      </div>
  </body>
  <script>
      $(".ivu-select-selection").on("click",function(){
          $(".ivu-select-dropdown").toggleClass("dis_none");
      })
      $(".ivu-select-item").on("click",function(){
          $(this).addClass("ivu-select-item-selected");
          $(this).siblings(".ivu-select-item").removeClass("ivu-select-item-selected");
          var aa=$(this).html();
          $(".ivu-select-selected-value").text(aa);
          $(".ivu-select-dropdown").toggleClass("dis_none");
      })
  </script>
  <script src="__STATIC__/layer/layer.js"></script>
  <script>
      var aLi=document.getElementsByClassName("check-style");
      var lab = document.getElementsByClassName("check-style");

      function ch(){
          var cc = $(".check-all").hasClass("ivu-checkbox-checked"); //false
          var checkLab = [];
          if (cc) {
              for (var i = 0; i < lab.length; i++) {
                  const e = lab[i];
                  checkLab.push(lab[i]);
                  lab[i].classList.add("ivu-checkbox-checked");
                  $(".check-all").addClass("ivu-checkbox-checked")
              }
          }else{
              for (var i = 0; i < lab.length; i++) {
                  const e = lab[i];
                  checkLab.push(lab[i]);
                  lab[i].classList.remove("ivu-checkbox-checked");
                  $(".check-all").removeClass("ivu-checkbox-checked")
              }
          }
      }

      // 全选按钮
      $(".check-all").click(function(){
          if($(".check-all").hasClass("ivu-checkbox-checked")){
              $(".check-all").removeClass("ivu-checkbox-checked")
          }else{
              $(".check-all").addClass("ivu-checkbox-checked")
          }
          ch();
      })

      // 单选
      function save_balance_id(obj,id) {
          $(obj).toggleClass("ivu-checkbox-checked")
          var have_class = $(obj).hasClass('ivu-checkbox-checked');
          if(!have_class){
              // balance_ids.push(id);
              $(".check-all").removeClass('ivu-checkbox-checked')
          }else{
              var onOff=true
              for (var i = 0; i < lab.length; i++) {
                  const e = lab[i];
                  if(lab[i].classList.contains('ivu-checkbox-checked')==false){
                      onOff=false;
                      return;
                  }
              }
              if(onOff){
                  $(".check-all").addClass("ivu-checkbox-checked");
              }
          }
      }

      //结算
      function balance() {
          var balance_ids = new Array();
          $(".ivu-checkbox-checked").each(function(index, element) {
              var balance_id = $(this).attr('goods_id');
              if(balance_id && balance_id != undefined){
                  balance_ids[balance_ids.length] = balance_id;
              }
          })
          // console.log(balance_ids);
          $.ajax({
              type:'post',
              url:'{:url("balance")}',
              data:{'ids':balance_ids.join(',')},
              beforeSend:function(){
                  layer.msg('请求已提交，请耐心等待后台审核', {icon: 1,time:1500,shade: 0.1});
              },
              success:function(e){
                  console.log(e);
              }
          })
      }

      //搜索记录
      function likeGoods() {
          var keywords = $('#like_goods').val();
          window.location.href = '/index/Market/balance/keywords/'+keywords;
      }

      //提现
      function cash() {
          window.location.href = '/index/Market/cash';
      }
  </script>
</html>
